<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	request.setAttribute("path", path);//只是为了让el表达式更短一些
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="expires" content="0">
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="This is my page">
<link rel="icon" href="favicon.ico">

<!-- Bootstrap core CSS -->
<link href="${path}/res/css/bootstrap(2).min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="${path}/res/css/bootstrap-theme.min.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="${path}/res/js/html5shiv.min.js"></script>
      <script src="${path}/res/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="container" ng-app="myapp">
	<!-- =======================header=========================== -->
	<header class="navbar-default">
		<nav class="navbar navbar-default navbar-inverse" role="navigation">
			<div class="container">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed"
						data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
						<span class="sr-only">展开</span> <span class="icon-bar"></span> <span
							class="icon-bar"></span> <span class="icon-bar"></span>
					</button>
					<!-- logo 图片随便放的 -->
					<div class="pull-left" id="header-logo">
						<a href="home"><img width="42px" height="42px"
							src="${path}/favicon.ico"></a>
					</div>
					<a class="navbar-brand hidden-xs" href="${path}/">&nbsp;教学资源管理系统&nbsp;</a>
					<form action="admin/search" class="visible-xs form-horizontal"
						id="nav_search" role="form"
						style="padding: 8px;overflow: hidden;padding-left: 16px;">
						<div class="input-group">
							<input type="text" class="form-control" name="userKey"
								placeholder="按学号或工号或姓名搜索用户" required> <span
								class="input-group-btn">
								<button type="submit" id="nav_search_xs_submit"
									class="btn btn-default">搜索</button>
							</span>
						</div>
					</form>
				</div>

				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse"
					id="bs-example-navbar-collapse-1">
					<form action="admin/search"
						class="navbar-form navbar-left hidden-xs" id="nav_search"
						role="search">
						<div class="input-group" style="overflow: hidden;width: 350px;">
							<input type="text" class="form-control" id="userKey"
								name="userKey" placeholder="按学号或工号或姓名搜索用户" required> <span
								class="input-group-btn">
								<button type="submit" class="btn btn-default">搜索</button>
							</span>
						</div>
						<div class="input-append"></div>
					</form>
					<ul class="nav navbar-nav navbar-right" style="margin-right: 10px">
						<%
							if (request.getSession().getAttribute("username") == null) {
						%>
						<li><a href="login">登陆</a></li>
						<%
							} else {
						%>
						<li><a href="account">欢迎你:${username}</a></li>
						<li><a href="logout">注销</a></li>
						<%
							}
						%>
					</ul>
				</div>
				<!-- /.navbar-collapse -->
			</div>
			<!-- /.container -->
		</nav>
	</header>

	<div class="row">
		<div class="panel-group" role="tablist">
			<div class="panel panel-default">
				<div class="panel-heading panel-title"
					id="collapseListGroupHeading1">
					<div class="row">
						<div class="col-sm-12 col-xs-12 row">
							<div class="col-sm-1 col-xs-1 text-center">#</div>
							<div class="col-sm-3 col-xs-3 text-center">工号或学号</div>
							<div class="col-sm-3 col-xs-3 text-center">姓名</div>
							<div class="col-sm-3 col-xs-3 text-center">类型</div>
							<div class="col-sm-2 col-xs-2 text-center">性别</div>
						</div>
					</div>
				</div>
				<div class="panel-collapse" id="hello"
					ng-controller='UserController' role="tabpanel"
					aria-labelledby="collapseListGroupHeading1" aria-expanded="true"
					style="">
					<ul class="list-group">
						<li class="list-group-item" ng-mouseover="mousein($index)"
							ng-repeat="row in users">
							<div class="row">
								<div class="col-sm-12 row" data-toggle="collapse"
									data-target="#demo{{$index}}" style="cursor: pointer;">
									<div class="col-sm-1 col-xs-1 text-center" ng-bind="$index"></div>
									<div class="col-sm-3 col-xs-3 text-center" ng-bind="row.id"></div>
									<div class="col-sm-3 col-xs-3 text-center" ng-bind="row.name"></div>
									<div class="col-sm-3 col-xs-3 text-center" ng-bind="row.type"></div>
									<div class="col-sm-2 col-xs-2 text-center" ng-bind="row.sex"></div>
								</div>
							</div>
							<div id="demo{{$index}}" class="collapse row">
								<div class="col-sm-offset-3">
									<form action="admin/accountSave2" class="form-horizontal"
										role="form" name="form1" method="post">
										<div class="form-group">
											<div class="col-sm-offset-2 col-sm-6">
												<p id="fail_reazon" class="form-control-static text-warning"></p>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label" ng-if="row.type=='教师'">工号</label>
											<label class="col-sm-2 control-label" ng-if="row.type=='学生'">学号</label>
											<div class="col-sm-6 ">
												<p class="form-control-static" ng-bind="row.id"></p>
												<input type="hidden" name="id" value={{row.id}} /> <input
													type="hidden" name="type" value={{row.type}} />
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label" for="name">姓名</label>
											<div class="col-sm-6 ">
												<input id="name" name="name" class="form-control"
													type="text" value={{row.name}}>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">性别</label>
											<div class="col-sm-6 form-control-static" ng-bind="row.sex"></div>
										</div>
										<div class="form-group" ng-if="row.type=='学生'">
											<label class="col-sm-2 control-label" for="classNum">班级</label>
											<div class="col-sm-6">
												<input id="classNum" name="classNum" class="form-control"
													type="text" value={{row.classNum}} />
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">学院</label>
											<div class="col-sm-6 form-control-static" ng-bind="row.dep"></div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">专业</label>
											<div class="col-sm-6 form-control-static" ng-bind="row.major"></div>
										</div>
										<div class="form-group" ng-if="row.type=='教师'">
											<lable class="col-sm-2 control-label-static">学位</lable>
											<div class="col-sm-6 form-control-static"
												ng-bind="row.degree"></div>
										</div>
										<!-- <div class="form-group">
											<label class="col-sm-2 control-label" for="birthday">出生日期</label>
											<div class="col-sm-6">
												<input name="birthday" class="form-control" type="date"
													value={{row.birthday}}>
											</div>
										</div> -->
										<div class="form-group">
											<label class="col-sm-2 control-label" for="password">密码</label>
											<div class="col-sm-6">
												<input name="password" class="form-control" name="password"
													type="password" value={{row.password}}>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label" for="email">邮箱</label>
											<div class="col-sm-6">
												<input name="email" class="form-control" name="email"
													type="email" value={{row.email}}>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label" for="phone">电话</label>
											<div class="col-sm-6">
												<input name="phone" class="form-control" name="phone"
													type="tel" value={{row.phone}}>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label" for="address"
												ng-if="row.type=='学生'">宿舍地址</label> <label
												class="col-sm-2 control-label" for="address"
												ng-if="row.type=='教师'">办公室地址</label>
											<div class="col-sm-6">
												<input id="address" name="address" class="form-control"
													type="text" size="30" value={{row.address}}>
											</div>
										</div>
										<div class="form-group" style='margin-top:30px;'>
											<input id="save_btn"
												class="col-sm-offset-4 col-xs-offset-4 btn btn-success btn-lg"
												type="submit" value="save">
										</div>
									</form>
								</div>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>

	<!-- ========================footer========================== -->
	<jsp:include page="/footer.jsp"></jsp:include>
	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="${path}/res/js/jquery.min.js"></script>
	<script src="${path}/res/js/bootstrap.min.js"></script>
	<script src="${path}/res/js/angular.min.js"></script>
	<script src="${path}/res/js/admin.js"></script>
	<script type="text/javascript">
		var users = '${userJson}';
	</script>
</body>
</html>
